package com.mresources.web.controller;

import com.mresources.common.dto.Result;
import com.mresources.common.dto.vo.UserInfoVo;
import com.mresources.common.dto.vo.UserStorageVo;
import com.mresources.user.service.UserService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/user")
public class UserController {
    @Resource
    private UserService userService;

    @GetMapping("/info")
    public Result<UserInfoVo> getUserInfo() {
        UserInfoVo user = userService.getUserInfo("");
        return Result.success().withData(user);
    }

    @GetMapping("/login")
    public Result<String> login() {
        return Result.success().withoutData();
    }

    @GetMapping("/storage")
    public Result<UserStorageVo> storage() {
        UserStorageVo storageVo = userService.getStorageInfo("");
        return Result.success(200, "success").withData(storageVo);
    }
}
